# -*- coding:utf-8 -*-
# --author： jingfeng 
# time: 2018/11/16

from urllib import request
import re
from fake_useragent import UserAgent

ua = UserAgent()
print(ua.random)
headers = {'User-Agent':ua.random}


def db():
    pass
def get_url():
    url = 'http://so.jb51.net/cse/search?q=python&p=0&s=10520733385329581432&nsid=0'
    req = request.Request(url=url,headers=headers)
    response = request.urlopen(req).read().decode('utf-8')
   # print(response)

    number = re.findall(r'<span class="support-text-top">为您找到相关结果(.*?)个</span>',response)[0].replace(',','')
    print(number)
    number = eval(number)
    if number%10==0:
        page = number/10

    else:
        page = number/10 +1
    print(page)
def download():


    pass


get_url()